package cn.lyd.service.impl;

import cn.lyd.domain.Student;
import cn.lyd.mapper.StudentMapper;
import cn.lyd.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class StudentServiceImpl implements IStudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }

    @Override
    public Student loadById(Long id) {
        return studentMapper.loadById(id);
    }

    @Override
    @Transactional
    public void save(Student student) {
        studentMapper.save(student);

    }

    @Override
    @Transactional
    public void update(Student student) {
        studentMapper.update(student);
    }

    @Override
    @Transactional
    public void delete(Long id) {
        studentMapper.delete(id);
    }
}
